<?php
  define('ACC', true);
require('./include/init.php');
session_start(); 
//print_r($_SESSION);
$userid = $_SESSION['user_id'];

echo '<head><meta charset = "utf-8"></head>'; 

echo '<h2>结账&nbsp|&nbsp<a href = "account_balance.php">返回分类账簿页面</a></h2><br/>';    

$company = new companymodel();
$companyinfo = $company->getcompanyinfo($userid);
$companyid = $companyinfo['company_id'];
$accounting = new accountingmodel(); 

$accountid = $_GET['accountid'];
$accountinfo =  $accounting->getaccountinfo($accountid);

$accounting->settleaccount($companyid, $accountid);
echo '<' . $accountinfo['account_name_ch'] . '>账户结账完成'; 

?>
